﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Pages_BusPlannerMaster : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            lnkhomepage.Attributes.Add("class", "");
            lnkcontact.Attributes.Add("class", "");
            lnktickets.Attributes.Add("class", "");
            lnklines.Attributes.Add("class", "");
            lnkplanner.Attributes.Add("class", "");
            string rawurl = Request.RawUrl.ToLower();

            rawurl = rawurl.Substring(rawurl.LastIndexOf("/") + 1);
            if (rawurl.IndexOf(".aspx?") >= 0)
                rawurl = rawurl.Substring(0, rawurl.IndexOf(".aspx?"));
            else
            {
                rawurl = rawurl.Substring(0, rawurl.IndexOf(".aspx"));
            }
            HyperLink lnk = Page.Master.FindControl("lnk" + rawurl) as HyperLink;
            if (lnk != null)
            {
                lnk.Attributes.Add("class", "active");
            }
            else
            {
                lnkhomepage.Attributes.Add("class", "active");
            }
        }

    }
}
